<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<div>
  SET NAMES utf8mb4;
  SET FOREIGN_KEY_CHECKS = 0;

  -- ----------------------------
  -- Table structure for user_favorites
  -- ----------------------------
  DROP TABLE IF EXISTS `user_favorites`;
  CREATE TABLE `user_favorites`  (
  `user_id` int unsigned NOT NULL COMMENT 'User ID',
  `work_id` int unsigned NOT NULL COMMENT 'Work ID',
  `favorite_time` datetime(0) DEFAULT CURRENT_TIMESTAMP COMMENT 'Favorite time',
  PRIMARY KEY (`user_id`, `work_id`) USING BTREE,
  INDEX `idx_work_id`(`work_id`) USING BTREE
  ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = 'User favorites association table' ROW_FORMAT = Dynamic;

  -- ----------------------------
  -- Records of user_favorites
  -- ----------------------------
  INSERT INTO `user_favorites` VALUES (1, 1, '2024-12-10 20:44:19');

  -- ----------------------------
  -- Table structure for user_recommendations
  -- ----------------------------
  DROP TABLE IF EXISTS `user_recommendations`;
  CREATE TABLE `user_recommendations`  (
  `user_id` int unsigned NOT NULL COMMENT 'User ID',
  `work_id` int unsigned NOT NULL COMMENT 'Work ID',
  `recommendation_time` datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'Recommendation time',
  PRIMARY KEY (`user_id`, `work_id`, `recommendation_time`) USING BTREE
  ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = 'User recommendations association table' ROW_FORMAT = Dynamic;

  -- ----------------------------
  -- Records of user_recommendations
  -- ----------------------------
  INSERT INTO `user_recommendations` VALUES (1, 1, '2024-12-08 20:44:52');

  -- ----------------------------
  -- Table structure for user_views
  -- ----------------------------
  DROP TABLE IF EXISTS `user_views`;
  CREATE TABLE `user_views`  (
  `user_id` int unsigned NOT NULL COMMENT 'User ID',
  `work_id` int unsigned NOT NULL COMMENT 'Work ID',
  `view_time` datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'View time',
  PRIMARY KEY (`user_id`, `work_id`, `view_time`) USING BTREE
  ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = 'User views association table' ROW_FORMAT = Dynamic;

  -- ----------------------------
  -- Records of user_views
  -- ----------------------------
  INSERT INTO `user_views` VALUES (1, 1, '2024-12-08 20:44:38');

  -- ----------------------------
  -- Table structure for user_works
  -- ----------------------------
  DROP TABLE IF EXISTS `user_works`;
  CREATE TABLE `user_works`  (
  `user_id` int unsigned NOT NULL COMMENT 'User ID',
  `work_id` int unsigned NOT NULL COMMENT 'Work ID',
  PRIMARY KEY (`user_id`, `work_id`) USING BTREE,
  INDEX `idx_work_id`(`work_id`) USING BTREE
  ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = 'User published works association table' ROW_FORMAT = Dynamic;

  -- ----------------------------
  -- Records of user_works
  -- ----------------------------
  INSERT INTO `user_works` VALUES (1, 1);

  -- ----------------------------
  -- Table structure for users
  -- ----------------------------
  DROP TABLE IF EXISTS `users`;
  CREATE TABLE `users`  (
  `id` int unsigned NOT NULL COMMENT 'User ID, auto-increment starting from 100',
  `name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT 'User name',
  `gender` enum('male','female','other') CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT 'User gender',
  `account` int unsigned NOT NULL COMMENT 'User account, stateless',
  `password` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT 'User password',
  `email` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT 'User email',
  `phone` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT 'User phone number',
  `avatar` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT 'assets/img/user.png' COMMENT 'User avatar URL',
  PRIMARY KEY (`id`) USING BTREE,
  UNIQUE INDEX `email`(`email`) USING BTREE
  ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = 'User table' ROW_FORMAT = Dynamic;

  -- ----------------------------
  -- Records of users
  -- ----------------------------
  INSERT INTO `users` VALUES (1, 'kk', 'male', 12345678, '123456', '231@qq.com', '13153697034', 'assets/img/user.png');

  -- ----------------------------
  -- Table structure for work_categories
  -- ----------------------------
  DROP TABLE IF EXISTS `work_categories`;
  CREATE TABLE `work_categories`  (
  `id` int unsigned NOT NULL COMMENT 'Category ID',
  `category_name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT 'Category name',
  PRIMARY KEY (`id`) USING BTREE,
  UNIQUE INDEX `category_name`(`category_name`) USING BTREE
  ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = 'Work category table' ROW_FORMAT = Dynamic;

  -- ----------------------------
  -- Records of work_categories
  -- ----------------------------
  INSERT INTO `work_categories` VALUES (5, '仙侠');
  INSERT INTO `work_categories` VALUES (9, '体育');
  INSERT INTO `work_categories` VALUES (13, '其他');
  INSERT INTO `work_categories` VALUES (11, '军事');
  INSERT INTO `work_categories` VALUES (7, '历史');
  INSERT INTO `work_categories` VALUES (8, '奇幻');
  INSERT INTO `work_categories` VALUES (12, '武侠');
  INSERT INTO `work_categories` VALUES (3, '游戏');
  INSERT INTO `work_categories` VALUES (1, '玄幻');
  INSERT INTO `work_categories` VALUES (6, '现实');
  INSERT INTO `work_categories` VALUES (2, '科幻');
  INSERT INTO `work_categories` VALUES (4, '诸天无限');
  INSERT INTO `work_categories` VALUES (10, '都市');

  -- ----------------------------
  -- Table structure for work_category_associations
  -- ----------------------------
  DROP TABLE IF EXISTS `work_category_associations`;
  CREATE TABLE `work_category_associations`  (
  `work_id` int unsigned NOT NULL COMMENT 'Work ID',
  `category_id` int unsigned NOT NULL COMMENT 'Category ID',
  PRIMARY KEY (`work_id`, `category_id`) USING BTREE,
  INDEX `idx_category_id`(`category_id`) USING BTREE
  ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = 'Work and category association table' ROW_FORMAT = Dynamic;

  -- ----------------------------
  -- Records of work_category_associations
  -- ----------------------------
  INSERT INTO `work_category_associations` VALUES (1, 3);

  -- ----------------------------
  -- Table structure for works
  -- ----------------------------
  DROP TABLE IF EXISTS `works`;
  CREATE TABLE `works`  (
  `id` int unsigned NOT NULL COMMENT 'Work ID, auto-increment',
  `introduction` text CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT 'Work introduction',
  `title` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT 'Work title',
  `publish_time` datetime(0) NOT NULL COMMENT 'Work publish time',
  `content` text CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT 'Work content',
  `cover` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT 'Work cover image URL',
  PRIMARY KEY (`id`) USING BTREE
  ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = 'Work table' ROW_FORMAT = Dynamic;

  -- ----------------------------
  -- Records of works
  -- ----------------------------
  INSERT INTO `works` VALUES (1, '大唐，贞观十二年冬。\r\n\r\n        百千家似围棋局，十二街如种菜畦。\r\n\r\n        遥认微微入朝火，一条星宿五门西。\r\n\r\n        卯时初，诺大的长安城仿似一头亘古巨兽蛰伏在黑暗之中。\r\n\r\n        星月无光，北风萧萧，鹅毛般的大雪扑簌簌的落满街巷屋脊，踏着厚厚的积雪，一行行举着火把的车队从各个里坊刚刚由坊卒打开的坊门走出，汇聚到朱雀大街，浩浩荡荡的前往承天门，准备上朝。\r\n\r\n        早朝时辰将至，然则梁国公、尚书左仆射房玄龄的府邸却是人声吵杂、乱作一团。\r\n\r\n        将至花甲的房玄龄一身朝服，负手站在庭院当中，仰首望着铺满积雪的屋顶，满面忧色。\r\n\r\n        一个衣衫单薄的少年正坐在屋顶，手里拎着个酒坛子，时不时的喝上一口，长吁短叹。\r\n\r\n        这时一个十二三岁的小丫鬟跑过来，“噗通”跪在房玄龄面前，膝盖顿时没入一寸厚的积雪中。\r\n\r\n        “呜呜……老爷，都是我的错，没有看住二少爷……呜呜……”\r\n\r\n        小丫鬟俏儿是二少爷的贴身侍女，刚刚睡醒，才知道二少爷天不亮就跑到屋顶喝酒，自己居然一点都不知道。二少爷可是病了好多天，这才刚刚见好，万一受了风寒可怎么得了？\r\n\r\n        心里自责没有及时发现二少爷的行踪，小丫鬟哭得那叫一个梨花带雨。\r\n\r\n        屋里一阵脚步杂乱，主母卢氏风风火火的跑出来，口中急问：“在哪儿呢？在哪儿呢？”\r\n\r\n        房玄龄叹口气，指了指屋顶。\r\n\r\n        卢氏显然刚刚起床，头发尚未梳理整齐，一抬头看见屋顶“听雪饮酒”的二儿子，顿时大叫：“儿啊，你且下来，这天寒地冻的，莫要冻出个好歹……”\r\n\r\n        次子遗爱前些时日出城狩猎不慎坠马，磕了', '神，请让我再死一次', '2024-12-03 20:43:35', 'kk', NULL);

  SET FOREIGN_KEY_CHECKS = 1;
</div>

</body>
</html>